<?php
	

	class xl_dia_diem_chinh_sua extends database
	{
		// thuỳ
		function danhSachDiaDiemChinhSua($manguoidung)
		{
			$this->setQuerry("select * from diadiemchinhsua, diadiem, quanhuyen, tinhthanh where diadiem.madiadiem=diadiemchinhsua.madiadiem and quanhuyen.maquanhuyen=diadiem.maquanhuyen and tinhthanh.matinhthanh=diadiem.matinhthanh and diadiemchinhsua.manguoidung=".$manguoidung);
			$result = $this->loadAllRow();
			return $result;
		}
		function danhSachDiaDiemChinhSua_First($manguoidung)
		{
			$this->setQuerry("select * from diadiemchinhsua, diadiem, quanhuyen, tinhthanh where diadiem.madiadiem=diadiemchinhsua.madiadiem and quanhuyen.maquanhuyen=diadiem.maquanhuyen and tinhthanh.matinhthanh=diadiem.matinhthanh and diadiemchinhsua.manguoidung=".$manguoidung." order by diadiem.madiadiem ASC limit 0,10");
			$result = $this->loadAllRow();
			return $result;
		}
		function danhSachDiaDiemChinhSua_ViewMore($manguoidung,$madiadiem)
		{
			$this->setQuerry("select * from diadiemchinhsua, diadiem, quanhuyen, tinhthanh where diadiem.madiadiem=diadiemchinhsua.madiadiem and quanhuyen.maquanhuyen=diadiem.maquanhuyen and tinhthanh.matinhthanh=diadiem.matinhthanh and diadiemchinhsua.manguoidung=".$manguoidung." and diadiem.madiadiem >".$madiadiem." order by diadiem.madiadiem ASC limit 0,10");
			$result = $this->loadAllRow();
			return $result;
		}
		//
		function themDiaDiemChinhSua($madiadiem,$manguoidung)

		{
			$this->setQuerry("insert into diadiemchinhsua (MaDiaDiem, MaNguoiDung) values('$madiadiem','$manguoidung')");
			$result=$this->querry();
			return $result;
		}
		function capNhatDiaDiemChinhSua($machinhsua,$madiadiem,$manguoidung)
		{
			$this->setQuerry("update diadiemchinhsua set MaDiaDiem=$madiadiem, MaNguoiDung=$manguoidung where MaChinhSua=$machinhsua");
			$result=$this->querry();
			return $result;
		}
		function xoaDiaDiemChinhSua($machinhsua)
		{
			$this->setQuerry("delete from diadiemchinhsua where Machinhsua=".$machinhsua);
			$result=$this->querry();
			return $result;
		}
		function danhSachDiaDiemMoiChinhSua()
		{
			$this->setQuerry("select * from diadiemchinhsua, diadiem, quanhuyen, tinhthanh where diadiem.madiadiem=diadiemchinhsua.madiadiem and quanhuyen.maquanhuyen=diadiem.maquanhuyen and tinhthanh.matinhthanh=diadiem.matinhthanh and quanhuyen.matinhthanh=tinhthanh.matinhthanh order by diadiemchinhsua.machinhsua desc limit 0,10");
			$result = $this->loadAllRow();
			return $result;
		}
	}
?>